#include <iostream>
#include <ctime>
#include <cstring>
using namespace std;

/********* 排序(快排~快速选择、归并~分治) **********/
/*
const int N = 1e5 + 10;
int arr[N];
int n;

//三路快排
void sort(int l, int r)
{
    if(l >= r) return;
    int k = arr[rand() % (r - l + 1) + l];
    //[l, left] < k，[right, r] > k，[left, i] == k
    int i = l, left = l - 1, right = r + 1;
    while(i < right)
    {
        if(arr[i] < k) swap(arr[i++], arr[++left]);
        else if(arr[i] > k) swap(arr[i], arr[--right]);
        else    ++i;
    }
    sort(l, left);
    sort(right, r);
}

int main()
{
    scanf("%d", &n);
    srand(time(0));
    for(int i = 0; i < n; ++i) scanf("%d", arr + i);
    sort(0, n - 1);
    for(int i = 0; i < n; ++i) printf("%d ", arr[i]);
    return 0;
}
*/

/*
//快速选择算法
const int N = 1e5 + 10;
int arr[N];
int n;

int qselect(int l, int r, int kth)
{
    int k = arr[rand() % (r - l + 1) + l];
    int i = l, left = l - 1, right = r + 1;
    while(i < right)
    {
        if(arr[i] < k) swap(arr[i++], arr[++left]);
        else if(arr[i] > k) swap(arr[i], arr[--right]);
        else ++i;
    }
    //[l, left] < k，[right, r] > k，[left, i] == k
    // kth落在第一个区间，那就不用去其他区间找了
    // kth落在第二个区间，结果就是k
    // kth落在第三个区间，相当于在第三个区间找 kth - 前两个区间的长度
    if(left - l + 1 >= kth)
        return qselect(l, left, kth);
    else if(i - l >= kth)
        return k;
    else
        return qselect(right, r, kth - (i - l));
}
int main()
{
    int k;
    scanf("%d%d", &n, &k);
    for(int i = 0; i < n; ++i) scanf("%d", arr + i);
    int ans = qselect(0, n - 1, k);
    printf("%d", ans);
    return 0;
}
*/

// 归并排序 (分治思想，左边排排序，右边排排序，合并两个有序数组)
/*
const int N = 1e5 + 10;
int arr[N], tmp[N];
int n;
void mergesort(int l, int r)
{
    if (l >= r)
        return;
    int mid = (l + r) >> 1;
    mergesort(l, mid);
    mergesort(mid + 1, r);
    int i = l, j = mid + 1, k = 0;
    while (i <= mid && j <= r)
        tmp[k++] = arr[i] < arr[j] ? arr[i++] : arr[j++];
    while (i <= mid)
        tmp[k++] = arr[i++];
    while (j <= r)
        tmp[k++] = arr[j++];
    memcpy(arr + l, tmp, sizeof(int) * (r - l + 1));
}
int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; ++i)
        scanf("%d", arr + i);
    mergesort(0, n - 1);
    for (int i = 0; i < n; ++i)
        printf("%d ", arr[i]);
    return 0;
}
*/

// 逆序对数量 (分治： 找左边区间的逆序对，和右边的逆序对；顺便排排序，再更新左边的逆序对)
/*
const int N = 1e5 + 10;
int arr[N], tmp[N];
int n;
int merge(int l, int r)
{
    if (l >= r)
        return 0;
    int mid = (l + r) >> 1;
    int n1 = merge(l, mid);
    int n2 = merge(mid + 1, r);
    int sum = n1 + n2;
    int i = l, j = mid + 1, k = 0;
    while (i <= mid && j <= r)
    {
        //这里应当 <= 时i往后移，如果j往后移，会把两个相同的值也看成一个逆序对
        if (arr[i] <= arr[j])
        {
            tmp[k++] = arr[i++];
            sum += j - mid - 1;
        }
        else
            tmp[k++] = arr[j++];
    }
    while (i <= mid)
    {
        tmp[k++] = arr[i++];
        sum += j - mid - 1;
    }
    while (j <= r)
        tmp[k++] = arr[j++];
    memcpy(arr + l, tmp, sizeof(int) * (r - l + 1));
    return sum;
}

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; ++i)
        scanf("%d", arr + i);
    int ans = merge(0, n - 1);
    printf("%d", ans);
    return 0;
}
*/

/************* 二分 **************/
// 整数二分：数的范围
/*
const int N = 1e5 + 10;
int arr[N];
int n, q, k;

void bfind()
{
    int l = 0, r = n - 1;
    // 找左区间, 划分成 <k , >=k 两个区间
    while (l < r)
    {
        int mid = (r + l) >> 1;
        if (arr[mid] < k)
            l = mid + 1;
        else
            r = mid;
    }
    if (arr[l] != k)
    {
        printf("-1 -1\n");
        return;
    }
    printf("%d ", l);
    l = 0, r = n - 1;
    // 找右区间, 划分成 <=k , >k 两个区间
    while (l < r)
    {
        int mid = (l + r + 1) >> 1;
        if (arr[mid] > k)
            r = mid - 1;
        else
            l = mid;
    }
    printf("%d\n", l);
}
int main()
{
    scanf("%d%d", &n, &q);
    for (int i = 0; i < n; ++i)
        scanf("%d", arr + i);
    while (q--)
    {
        scanf("%d", &k);
        bfind();
    }
    return 0;
}
*/

// 浮点数二分：数的三次方根 (由于函数单调递增，可以划分为 < n 和 > n 的区间。终止条件：浮点数相等判断 abs(a - b) < e-8)
/*
int main()
{
    // −10000 ≤ n ≤ 10000
    double n;
    scanf("%lf", &n); // scanf("%llf", &n); err
    double l = -30, r = 30;
    // const double k = e-8; //err
    while (r - l > 1e-8)
    {
        double mid = (l + r) / 2;
        if (mid * mid * mid > n)
            r = mid;
        else
            l = mid;
    }
    printf("%lf", l);
    return 0;
}*/

#include <string>
#include <vector>
#include <algorithm>
/************ 高精度 ************/
// 加法 (进位只能为 0 或 1)
/*
string a, b;
int main()
{
    cin >> a >> b;
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());
    vector<int> ans;
    int n1 = a.size(), n2 =b.size();
    int m = max(n1, n2);
    ans.reserve(m);
    int next = 0;
    for(int i = 0, j = 0; i < n1 || j < n2; ++i, ++j)
    {
        if(i < n1) next += a[i] - '0';
        if(j < n2) next += b[j] - '0';
        ans.push_back(next % 10);
        next /= 10;
    }
    if(next)    ans.push_back(1);
    reverse(ans.begin(), ans.end());
    for(auto& e : ans) printf("%d", e);
    return 0;
}*/

// 减法 借位
/*
void sub(string &a, string &b)
{
    int pre = 0;
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());
    vector<int> ans;
    int n1 = a.size(), n2 = b.size();
    ans.reserve(n1);
    for (int i = 0, j = 0; i < n1; ++i, ++j)
    {
        //  不要这样写，如果j走完了，tmp = a[i] - pre; 没有减掉'0'
        // int tmp = a[i] - pre;
        // if (j < n2)
        //     tmp -= b[j];

        int tmp = a[i] - '0' - pre;
        if (j < n2)
            tmp -= b[j] - '0';
        if (tmp < 0)
        {
            tmp += 10;
            pre = 1;
        }
        else
            pre = 0;
        ans.push_back(tmp);
    }
    reverse(ans.begin(), ans.end());
    for (auto &e : ans)
        printf("%d", e);
}

int main()
{
    string a, b;
    cin >> a >> b;
    string ans;

    if (a.size() < b.size() || (a.size() == b.size() && a < b))
    {
        printf("-");
        sub(b, a);
    }
    else
        sub(a, b);
    return 0;
}
*/

// 高精度乘法
/*
// 高精度 乘 低精度 (a * b + 进位)
typedef long long ll;
void mul(string &a, int b)
{
    reverse(a.begin(), a.end());
    int n = a.size();
    ll next = 0;
    vector<int> ans;
    ans.reserve(n);
    for (int i = 0; i < n; ++i)
    {
        next += (a[i] - '0') * b;
        ans.push_back(next % 10);
        next /= 10;
    }
    for (; next; next /= 10)
        ans.push_back(next % 10);
    for (int i = ans.size() - 1; i >= 0; --i)
        printf("%d", ans[i]);
}

// 高精度 乘 高精度 (最后统一处理进位)
// a*10^i * b*10^j = a*b * 10^(i+j)
void mul(string &a, string &b)
{
    vector<ll> ans;
    int n1 = a.size(), n2 = b.size();
    reverse(a.begin(), a.end());
    reverse(a.begin(), a.end());
    ans.resize(n1 + n2 - 1);
    // 无进位相乘
    for (int i = 0; i < n1; ++i)
        for (int j = 0; j < n2; ++j)
            ans[i + j] += (a[i] - '0') * (b[j] - '0');
    // 处理进位
    ll next = 0;
    for (int i = 0; i < n1 + n2 - 1; ++i)
    {
        next += ans[i];
        ans[i] = next % 10;
        next /= 10;
    }
    for (; next; next /= 10)
        ans.push_back(next % 10);
    int i = ans.size() - 1;
    // while(ans[i] == 0 && i != 0) --i; //处理前导0. 这步没有必要，可以加if(a == 0 || b == 0) return 0;
    for (; i >= 0; --i)
        printf("%d", ans[i]);
}
int main()
{
    // string a;
    // int b;
    // cin >> a >> b;
    // if(b == 0) printf("0");
    // else mul(a, b);
    string a, b;
    cin >> a >> b;
    mul(a, b);
    return 0;
}*/

// 高精度除法
void div(string &a, int b)
{
    int n = a.size(), r = 0; // r是余数
    vector<int> ans(n);
    for (int i = 0; i < n; ++i)
    {
        r = r * 10 + a[i] - '0'; // 相当于左移1为。1和2组成12 => 1*10 + 2
        ans[i] = r / b;
        r %= b;
    }
    int i = 0;
    // 要留一个0
    while (i < n - 1 && ans[i] == 0)
        ++i;
    for (; i < n; ++i)
        printf("%d", ans[i]);
    printf("\n%d", r);
}
int main()
{
    string a;
    int b;
    cin >> a >> b;
    div(a, b);
    return 0;
}